use num_derive::{FromPrimitive, ToPrimitive};
use strum_macros::*;

#[derive(
    Debug,
    Clone,
    Copy,
    PartialEq,
    Eq,
    Hash,
    PartialOrd,
    Ord,
    EnumString,
    Display,
    EnumIter,
    EnumCount,
    FromPrimitive,
    ToPrimitive,
)]
pub enum Biome {
    Badlands,
    BadlandsPlateau,
    Beach,
    BirchForest,
    BirchForestHills,
    ColdOcean,
    DarkForest,
    DarkForestHills,
    DeepColdOcean,
    DeepFrozenOcean,
    DeepLukewarmOcean,
    DeepOcean,
    DeepWarmOcean,
    Desert,
    DesertHills,
    DesertLakes,
    EndBarrens,
    EndHighlands,
    EndMidlands,
    ErodedBadlands,
    FlowerForest,
    Forest,
    FrozenOcean,
    FrozenRiver,
    GiantSpruceTaiga,
    GiantSpruceTaigaHills,
    GiantTreeTaiga,
    GiantTreeTaigaHills,
    GravellyMountains,
    IceSpikes,
    Jungle,
    JungleEdge,
    JungleHills,
    LukewarmOcean,
    ModifiedBadlandsPlateau,
    ModifiedGravellyMountains,
    ModifiedJungle,
    ModifiedJungleEdge,
    ModifiedWoodedBadlandsPlateau,
    MountainEdge,
    Mountains,
    MushroomFieldShore,
    MushroomFields,
    Nether,
    Ocean,
    Plains,
    River,
    Savanna,
    SavannaPlateau,
    ShatteredSavanna,
    ShatteredSavannaPlateau,
    SmallEndIslands,
    SnowyBeach,
    SnowyMountains,
    SnowyTaiga,
    SnowyTaigaHills,
    SnowyTaigaMountains,
    SnowyTundra,
    StoneShore,
    SunflowerPlains,
    Swamp,
    SwampHills,
    Taiga,
    TaigaHills,
    TaigaMountains,
    TallBirchForest,
    TallBirchHills,
    TheEnd,
    TheVoid,
    WarmOcean,
    WoodedBadlandsPlateau,
    WoodedHills,
    WoodedMountains,
}
impl Biome {
    pub fn protocol_id(self) -> i32 {
        match self {
            Biome::Badlands => 37i32,
            Biome::BadlandsPlateau => 39i32,
            Biome::Beach => 16i32,
            Biome::BirchForest => 27i32,
            Biome::BirchForestHills => 28i32,
            Biome::ColdOcean => 46i32,
            Biome::DarkForest => 29i32,
            Biome::DarkForestHills => 157i32,
            Biome::DeepColdOcean => 49i32,
            Biome::DeepFrozenOcean => 50i32,
            Biome::DeepLukewarmOcean => 48i32,
            Biome::DeepOcean => 24i32,
            Biome::DeepWarmOcean => 47i32,
            Biome::Desert => 2i32,
            Biome::DesertHills => 17i32,
            Biome::DesertLakes => 130i32,
            Biome::EndBarrens => 43i32,
            Biome::EndHighlands => 42i32,
            Biome::EndMidlands => 41i32,
            Biome::ErodedBadlands => 165i32,
            Biome::FlowerForest => 132i32,
            Biome::Forest => 4i32,
            Biome::FrozenOcean => 10i32,
            Biome::FrozenRiver => 11i32,
            Biome::GiantSpruceTaiga => 160i32,
            Biome::GiantSpruceTaigaHills => 161i32,
            Biome::GiantTreeTaiga => 32i32,
            Biome::GiantTreeTaigaHills => 33i32,
            Biome::GravellyMountains => 131i32,
            Biome::IceSpikes => 140i32,
            Biome::Jungle => 21i32,
            Biome::JungleEdge => 23i32,
            Biome::JungleHills => 22i32,
            Biome::LukewarmOcean => 45i32,
            Biome::ModifiedBadlandsPlateau => 167i32,
            Biome::ModifiedGravellyMountains => 162i32,
            Biome::ModifiedJungle => 149i32,
            Biome::ModifiedJungleEdge => 151i32,
            Biome::ModifiedWoodedBadlandsPlateau => 166i32,
            Biome::MountainEdge => 20i32,
            Biome::Mountains => 3i32,
            Biome::MushroomFieldShore => 15i32,
            Biome::MushroomFields => 14i32,
            Biome::Nether => 8i32,
            Biome::Ocean => 0i32,
            Biome::Plains => 1i32,
            Biome::River => 7i32,
            Biome::Savanna => 35i32,
            Biome::SavannaPlateau => 36i32,
            Biome::ShatteredSavanna => 163i32,
            Biome::ShatteredSavannaPlateau => 164i32,
            Biome::SmallEndIslands => 40i32,
            Biome::SnowyBeach => 26i32,
            Biome::SnowyMountains => 13i32,
            Biome::SnowyTaiga => 30i32,
            Biome::SnowyTaigaHills => 31i32,
            Biome::SnowyTaigaMountains => 158i32,
            Biome::SnowyTundra => 12i32,
            Biome::StoneShore => 25i32,
            Biome::SunflowerPlains => 129i32,
            Biome::Swamp => 6i32,
            Biome::SwampHills => 134i32,
            Biome::Taiga => 5i32,
            Biome::TaigaHills => 19i32,
            Biome::TaigaMountains => 133i32,
            Biome::TallBirchForest => 155i32,
            Biome::TallBirchHills => 156i32,
            Biome::TheEnd => 9i32,
            Biome::TheVoid => 127i32,
            Biome::WarmOcean => 44i32,
            Biome::WoodedBadlandsPlateau => 38i32,
            Biome::WoodedHills => 18i32,
            Biome::WoodedMountains => 34i32,
        }
    }
    pub fn from_protocol_id(protocol_id: i32) -> Option<Self> {
        match protocol_id {
            37i32 => Some(Biome::Badlands),
            39i32 => Some(Biome::BadlandsPlateau),
            16i32 => Some(Biome::Beach),
            27i32 => Some(Biome::BirchForest),
            28i32 => Some(Biome::BirchForestHills),
            46i32 => Some(Biome::ColdOcean),
            29i32 => Some(Biome::DarkForest),
            157i32 => Some(Biome::DarkForestHills),
            49i32 => Some(Biome::DeepColdOcean),
            50i32 => Some(Biome::DeepFrozenOcean),
            48i32 => Some(Biome::DeepLukewarmOcean),
            24i32 => Some(Biome::DeepOcean),
            47i32 => Some(Biome::DeepWarmOcean),
            2i32 => Some(Biome::Desert),
            17i32 => Some(Biome::DesertHills),
            130i32 => Some(Biome::DesertLakes),
            43i32 => Some(Biome::EndBarrens),
            42i32 => Some(Biome::EndHighlands),
            41i32 => Some(Biome::EndMidlands),
            165i32 => Some(Biome::ErodedBadlands),
            132i32 => Some(Biome::FlowerForest),
            4i32 => Some(Biome::Forest),
            10i32 => Some(Biome::FrozenOcean),
            11i32 => Some(Biome::FrozenRiver),
            160i32 => Some(Biome::GiantSpruceTaiga),
            161i32 => Some(Biome::GiantSpruceTaigaHills),
            32i32 => Some(Biome::GiantTreeTaiga),
            33i32 => Some(Biome::GiantTreeTaigaHills),
            131i32 => Some(Biome::GravellyMountains),
            140i32 => Some(Biome::IceSpikes),
            21i32 => Some(Biome::Jungle),
            23i32 => Some(Biome::JungleEdge),
            22i32 => Some(Biome::JungleHills),
            45i32 => Some(Biome::LukewarmOcean),
            167i32 => Some(Biome::ModifiedBadlandsPlateau),
            162i32 => Some(Biome::ModifiedGravellyMountains),
            149i32 => Some(Biome::ModifiedJungle),
            151i32 => Some(Biome::ModifiedJungleEdge),
            166i32 => Some(Biome::ModifiedWoodedBadlandsPlateau),
            20i32 => Some(Biome::MountainEdge),
            3i32 => Some(Biome::Mountains),
            15i32 => Some(Biome::MushroomFieldShore),
            14i32 => Some(Biome::MushroomFields),
            8i32 => Some(Biome::Nether),
            0i32 => Some(Biome::Ocean),
            1i32 => Some(Biome::Plains),
            7i32 => Some(Biome::River),
            35i32 => Some(Biome::Savanna),
            36i32 => Some(Biome::SavannaPlateau),
            163i32 => Some(Biome::ShatteredSavanna),
            164i32 => Some(Biome::ShatteredSavannaPlateau),
            40i32 => Some(Biome::SmallEndIslands),
            26i32 => Some(Biome::SnowyBeach),
            13i32 => Some(Biome::SnowyMountains),
            30i32 => Some(Biome::SnowyTaiga),
            31i32 => Some(Biome::SnowyTaigaHills),
            158i32 => Some(Biome::SnowyTaigaMountains),
            12i32 => Some(Biome::SnowyTundra),
            25i32 => Some(Biome::StoneShore),
            129i32 => Some(Biome::SunflowerPlains),
            6i32 => Some(Biome::Swamp),
            134i32 => Some(Biome::SwampHills),
            5i32 => Some(Biome::Taiga),
            19i32 => Some(Biome::TaigaHills),
            133i32 => Some(Biome::TaigaMountains),
            155i32 => Some(Biome::TallBirchForest),
            156i32 => Some(Biome::TallBirchHills),
            9i32 => Some(Biome::TheEnd),
            127i32 => Some(Biome::TheVoid),
            44i32 => Some(Biome::WarmOcean),
            38i32 => Some(Biome::WoodedBadlandsPlateau),
            18i32 => Some(Biome::WoodedHills),
            34i32 => Some(Biome::WoodedMountains),
            _ => None,
        }
    }
    pub fn identifier(self) -> &'static str {
        match self {
            Biome::Badlands => "minecraft:badlands",
            Biome::BadlandsPlateau => "minecraft:badlands_plateau",
            Biome::Beach => "minecraft:beach",
            Biome::BirchForest => "minecraft:birch_forest",
            Biome::BirchForestHills => "minecraft:birch_forest_hills",
            Biome::ColdOcean => "minecraft:cold_ocean",
            Biome::DarkForest => "minecraft:dark_forest",
            Biome::DarkForestHills => "minecraft:dark_forest_hills",
            Biome::DeepColdOcean => "minecraft:deep_cold_ocean",
            Biome::DeepFrozenOcean => "minecraft:deep_frozen_ocean",
            Biome::DeepLukewarmOcean => "minecraft:deep_lukewarm_ocean",
            Biome::DeepOcean => "minecraft:deep_ocean",
            Biome::DeepWarmOcean => "minecraft:deep_warm_ocean",
            Biome::Desert => "minecraft:desert",
            Biome::DesertHills => "minecraft:desert_hills",
            Biome::DesertLakes => "minecraft:desert_lakes",
            Biome::EndBarrens => "minecraft:end_barrens",
            Biome::EndHighlands => "minecraft:end_highlands",
            Biome::EndMidlands => "minecraft:end_midlands",
            Biome::ErodedBadlands => "minecraft:eroded_badlands",
            Biome::FlowerForest => "minecraft:flower_forest",
            Biome::Forest => "minecraft:forest",
            Biome::FrozenOcean => "minecraft:frozen_ocean",
            Biome::FrozenRiver => "minecraft:frozen_river",
            Biome::GiantSpruceTaiga => "minecraft:giant_spruce_taiga",
            Biome::GiantSpruceTaigaHills => "minecraft:giant_spruce_taiga_hills",
            Biome::GiantTreeTaiga => "minecraft:giant_tree_taiga",
            Biome::GiantTreeTaigaHills => "minecraft:giant_tree_taiga_hills",
            Biome::GravellyMountains => "minecraft:gravelly_mountains",
            Biome::IceSpikes => "minecraft:ice_spikes",
            Biome::Jungle => "minecraft:jungle",
            Biome::JungleEdge => "minecraft:jungle_edge",
            Biome::JungleHills => "minecraft:jungle_hills",
            Biome::LukewarmOcean => "minecraft:lukewarm_ocean",
            Biome::ModifiedBadlandsPlateau => "minecraft:modified_badlands_plateau",
            Biome::ModifiedGravellyMountains => "minecraft:modified_gravelly_mountains",
            Biome::ModifiedJungle => "minecraft:modified_jungle",
            Biome::ModifiedJungleEdge => "minecraft:modified_jungle_edge",
            Biome::ModifiedWoodedBadlandsPlateau => "minecraft:modified_wooded_badlands_plateau",
            Biome::MountainEdge => "minecraft:mountain_edge",
            Biome::Mountains => "minecraft:mountains",
            Biome::MushroomFieldShore => "minecraft:mushroom_field_shore",
            Biome::MushroomFields => "minecraft:mushroom_fields",
            Biome::Nether => "minecraft:nether",
            Biome::Ocean => "minecraft:ocean",
            Biome::Plains => "minecraft:plains",
            Biome::River => "minecraft:river",
            Biome::Savanna => "minecraft:savanna",
            Biome::SavannaPlateau => "minecraft:savanna_plateau",
            Biome::ShatteredSavanna => "minecraft:shattered_savanna",
            Biome::ShatteredSavannaPlateau => "minecraft:shattered_savanna_plateau",
            Biome::SmallEndIslands => "minecraft:small_end_islands",
            Biome::SnowyBeach => "minecraft:snowy_beach",
            Biome::SnowyMountains => "minecraft:snowy_mountains",
            Biome::SnowyTaiga => "minecraft:snowy_taiga",
            Biome::SnowyTaigaHills => "minecraft:snowy_taiga_hills",
            Biome::SnowyTaigaMountains => "minecraft:snowy_taiga_mountains",
            Biome::SnowyTundra => "minecraft:snowy_tundra",
            Biome::StoneShore => "minecraft:stone_shore",
            Biome::SunflowerPlains => "minecraft:sunflower_plains",
            Biome::Swamp => "minecraft:swamp",
            Biome::SwampHills => "minecraft:swamp_hills",
            Biome::Taiga => "minecraft:taiga",
            Biome::TaigaHills => "minecraft:taiga_hills",
            Biome::TaigaMountains => "minecraft:taiga_mountains",
            Biome::TallBirchForest => "minecraft:tall_birch_forest",
            Biome::TallBirchHills => "minecraft:tall_birch_hills",
            Biome::TheEnd => "minecraft:the_end",
            Biome::TheVoid => "minecraft:the_void",
            Biome::WarmOcean => "minecraft:warm_ocean",
            Biome::WoodedBadlandsPlateau => "minecraft:wooded_badlands_plateau",
            Biome::WoodedHills => "minecraft:wooded_hills",
            Biome::WoodedMountains => "minecraft:wooded_mountains",
        }
    }
    pub fn from_identifier(identifier: &str) -> Option<Self> {
        match identifier {
            "minecraft:badlands" => Some(Biome::Badlands),
            "minecraft:badlands_plateau" => Some(Biome::BadlandsPlateau),
            "minecraft:beach" => Some(Biome::Beach),
            "minecraft:birch_forest" => Some(Biome::BirchForest),
            "minecraft:birch_forest_hills" => Some(Biome::BirchForestHills),
            "minecraft:cold_ocean" => Some(Biome::ColdOcean),
            "minecraft:dark_forest" => Some(Biome::DarkForest),
            "minecraft:dark_forest_hills" => Some(Biome::DarkForestHills),
            "minecraft:deep_cold_ocean" => Some(Biome::DeepColdOcean),
            "minecraft:deep_frozen_ocean" => Some(Biome::DeepFrozenOcean),
            "minecraft:deep_lukewarm_ocean" => Some(Biome::DeepLukewarmOcean),
            "minecraft:deep_ocean" => Some(Biome::DeepOcean),
            "minecraft:deep_warm_ocean" => Some(Biome::DeepWarmOcean),
            "minecraft:desert" => Some(Biome::Desert),
            "minecraft:desert_hills" => Some(Biome::DesertHills),
            "minecraft:desert_lakes" => Some(Biome::DesertLakes),
            "minecraft:end_barrens" => Some(Biome::EndBarrens),
            "minecraft:end_highlands" => Some(Biome::EndHighlands),
            "minecraft:end_midlands" => Some(Biome::EndMidlands),
            "minecraft:eroded_badlands" => Some(Biome::ErodedBadlands),
            "minecraft:flower_forest" => Some(Biome::FlowerForest),
            "minecraft:forest" => Some(Biome::Forest),
            "minecraft:frozen_ocean" => Some(Biome::FrozenOcean),
            "minecraft:frozen_river" => Some(Biome::FrozenRiver),
            "minecraft:giant_spruce_taiga" => Some(Biome::GiantSpruceTaiga),
            "minecraft:giant_spruce_taiga_hills" => Some(Biome::GiantSpruceTaigaHills),
            "minecraft:giant_tree_taiga" => Some(Biome::GiantTreeTaiga),
            "minecraft:giant_tree_taiga_hills" => Some(Biome::GiantTreeTaigaHills),
            "minecraft:gravelly_mountains" => Some(Biome::GravellyMountains),
            "minecraft:ice_spikes" => Some(Biome::IceSpikes),
            "minecraft:jungle" => Some(Biome::Jungle),
            "minecraft:jungle_edge" => Some(Biome::JungleEdge),
            "minecraft:jungle_hills" => Some(Biome::JungleHills),
            "minecraft:lukewarm_ocean" => Some(Biome::LukewarmOcean),
            "minecraft:modified_badlands_plateau" => Some(Biome::ModifiedBadlandsPlateau),
            "minecraft:modified_gravelly_mountains" => Some(Biome::ModifiedGravellyMountains),
            "minecraft:modified_jungle" => Some(Biome::ModifiedJungle),
            "minecraft:modified_jungle_edge" => Some(Biome::ModifiedJungleEdge),
            "minecraft:modified_wooded_badlands_plateau" => {
                Some(Biome::ModifiedWoodedBadlandsPlateau)
            }
            "minecraft:mountain_edge" => Some(Biome::MountainEdge),
            "minecraft:mountains" => Some(Biome::Mountains),
            "minecraft:mushroom_field_shore" => Some(Biome::MushroomFieldShore),
            "minecraft:mushroom_fields" => Some(Biome::MushroomFields),
            "minecraft:nether" => Some(Biome::Nether),
            "minecraft:ocean" => Some(Biome::Ocean),
            "minecraft:plains" => Some(Biome::Plains),
            "minecraft:river" => Some(Biome::River),
            "minecraft:savanna" => Some(Biome::Savanna),
            "minecraft:savanna_plateau" => Some(Biome::SavannaPlateau),
            "minecraft:shattered_savanna" => Some(Biome::ShatteredSavanna),
            "minecraft:shattered_savanna_plateau" => Some(Biome::ShatteredSavannaPlateau),
            "minecraft:small_end_islands" => Some(Biome::SmallEndIslands),
            "minecraft:snowy_beach" => Some(Biome::SnowyBeach),
            "minecraft:snowy_mountains" => Some(Biome::SnowyMountains),
            "minecraft:snowy_taiga" => Some(Biome::SnowyTaiga),
            "minecraft:snowy_taiga_hills" => Some(Biome::SnowyTaigaHills),
            "minecraft:snowy_taiga_mountains" => Some(Biome::SnowyTaigaMountains),
            "minecraft:snowy_tundra" => Some(Biome::SnowyTundra),
            "minecraft:stone_shore" => Some(Biome::StoneShore),
            "minecraft:sunflower_plains" => Some(Biome::SunflowerPlains),
            "minecraft:swamp" => Some(Biome::Swamp),
            "minecraft:swamp_hills" => Some(Biome::SwampHills),
            "minecraft:taiga" => Some(Biome::Taiga),
            "minecraft:taiga_hills" => Some(Biome::TaigaHills),
            "minecraft:taiga_mountains" => Some(Biome::TaigaMountains),
            "minecraft:tall_birch_forest" => Some(Biome::TallBirchForest),
            "minecraft:tall_birch_hills" => Some(Biome::TallBirchHills),
            "minecraft:the_end" => Some(Biome::TheEnd),
            "minecraft:the_void" => Some(Biome::TheVoid),
            "minecraft:warm_ocean" => Some(Biome::WarmOcean),
            "minecraft:wooded_badlands_plateau" => Some(Biome::WoodedBadlandsPlateau),
            "minecraft:wooded_hills" => Some(Biome::WoodedHills),
            "minecraft:wooded_mountains" => Some(Biome::WoodedMountains),
            _ => None,
        }
    }
}
